﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Trippy.Abilities;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Trippy.Levels;

namespace Trippy.UI_Overlay
{
    public class UIOverlay
    {
        Level CurrentLevel;
        Texture2D scoreIcon, livesIcon;
        SpriteFont font;
        public UIOverlay(Level level)
        {
            livesIcon = level.Game.Content.Load<Texture2D>("Sprites/UI Elements/lives");
            scoreIcon = level.Game.Content.Load<Texture2D>("Sprites/UI Elements/score");
            font = level.Game.Content.Load<SpriteFont>("Fonts/UI");
            CurrentLevel = level;
        }
        public void draw(int score, int lives, Ability a, SpriteBatch sb)
        {
            for (int i = 0; i < lives; i++)
            {
                sb.Draw(livesIcon,
                    new Rectangle((i * 50) + 20, 20, 40, 40),
                    Color.White);
            }
            sb.Draw(scoreIcon,
                new Rectangle(20, 70, 40, 40),
                Color.White);
            sb.DrawString(font, String.Concat("x", Convert.ToString(score)),
                new Vector2(60, 80), CurrentLevel.UIColor);
            if (a != null)
            {
                a.OnDraw(sb, new Rectangle(sb.GraphicsDevice.Viewport.Width - 60, 20, 40, 40));
            }
        }
    }
}
